
/*
<div class="mui-card">
	<!--页眉，放置标题-->
	<div class="mui-card-header">页眉</div>
	<!--内容区-->
	<div class="mui-card-content">内容区</div>
	<!--页脚，放置补充信息或支持的操作-->
	<div class="mui-card-footer">页脚</div>
</div>
 */
window.cardCreate = function (targert, mui, index = 0) {
    var list = [
        [
            {
                title: '红色足迹|诞生-征程45455555',
                origin: '人民日报',
                diss: '988995人观看',
                img: 'https://dcloud.io/hellomui/images/yuantiao.jpg',
                video: '1.mp4',
                callback: function (data) {
                    console.log('-----------');
                }
            },
            {
                title: '热烈庆祝中国共产党成立100周年',
                origin: '新华网',
                diss: '999+',
                callback: function (data) {

                }
            },
            {
                title: '红色足迹|诞生-征程',
                origin: '人民日报',
                diss: 988995,
                callback: function (data) {
                    console.log('-----------');
                }
            },
            {
                title: '热烈庆祝中国共产党成立100周年',
                origin: '新华网',
                diss: '999+',
                callback: function (data) {

                }
            }
        ],
        [

        ],
        [
            {
                title: '陪你看每天的日升日落',
                origin: '人民日报',
                diss: '988995人观看',
                img: 'https://dcloud.io/hellomui/images/yuantiao.jpg',
                video: 'https://video.qiantucdn.com/58pic/36/30/85/42J58PICXHBJcVax2TNeh.mp4?e=1625125751&token=OyzEe_0O8H433pm7zVEjtnSy5dVdfpsIawO2nx3f:bUdEiDc-P8d9c1ylOiUDUto9efw=',
                callback: function (data) {
                }
            },
            {
                title: '陪你看每天的日升日落',
                origin: '人民日报',
                diss: '988995人观看',
                img: 'https://dcloud.io/hellomui/images/yuantiao.jpg',
                video: 'https://video.qiantucdn.com/58pic/36/30/85/42J58PICXHBJcVax2TNeh.mp4?e=1625125751&token=OyzEe_0O8H433pm7zVEjtnSy5dVdfpsIawO2nx3f:bUdEiDc-P8d9c1ylOiUDUto9efw=',
                callback: function (data) {
                }
            },
        ]
    ]
    var container = document.querySelector(targert)
    container.innerHTML = ''
    list[index]&&list[index].forEach((item, index) => {
        var card = document.createElement('div')
        card.setAttribute('class', 'mui-card')
        card.innerHTML = `
        <div class="mui-card-header">${item.title}</div>
        <div class="mui-card-content">
        <video src="${item.video}" autoplay="false" controls></video>
        <img src="${item.img}"/>
        </div>
        <div class="mui-card-footer" style="justify-content: flex-start"><span>${item.origin}</span><span style="margin-left: 15px">${item.diss}</span></div>`
        card.addEventListener('tap', function (e) {
            var querySelector = this.querySelector('.mui-card-content');
            querySelector.getElementsByTagName('img')[0].style.display = 'none'
            querySelector.getElementsByTagName('video')[0].play()
            item.callback(item, this)
        })
        container.appendChild(card)
    })
}
